#!/bin/bash

jop2_ver=1
jop_dir=$(dirname $0)
jop_conf=$jop_dir/jop.conf
jop2=$jop_dir/jop2
dir=

file-link() {
    local file=$1
    echo $(dir-link $file)/$(basename $file)
}

dir-link() {
    local file=$1
    cd $(dirname $file) > /dev/null
    pwd
}

file-mkx() {
    local source=$(file-link $1)
    local dest=~/$(basename $1)
    echo -e "#!/bin/bash\n\n. $source" > $dest
    chmod +x $dest
}

cmd=$1

if [ "$cmd" = "u" ]; then
    cd $jop_dir
    git clone https://gitee.com/7hens/jop.git
    file-mkx jop/jop
fi
